/*
 * Copyright (c) 2015 YCY Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *
 * $Id: Treegrid.java  2015-7-29 下午1:11:20 jackLiang $
 */
package com.jkwzms.system.resource.entity.tmp;

import java.io.Serializable;
import java.util.List;

import com.alibaba.fastjson.annotation.JSONField;
import com.google.common.collect.Lists;

/**
 * easyui treegrid model
 * 
 * @author JackLiang
 * @date 2015-7-29
 * @version 1.0.0
 */
public class Treegrid implements Serializable {

    private static final long serialVersionUID = 8174242331588448489L;

    private long              id;
    /**
     * 列名
     */
    private String            name;

    /**
     * 资源标识符 用于权限匹配的 如sys:resource
     */
    private String            identity;

    @JSONField(name = "iconCls")
    private String            icon;

    private String            url;
    /**
     * 是否打开状态
     */
    @JSONField(serialize = false)
    private String            state;

    private Boolean           show;
    /**
     * 子节点
     */
    private List<Treegrid>    children         = Lists.newArrayList();

    // 构造函数
    public Treegrid(long id, String name, String identity, String icon, String url, Boolean show){
        this.id = id;
        this.name = name;
        this.identity = identity;
        this.icon = icon;
        this.url = url;
        this.show = show;
    }

    // getter setter
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIdentity() {
        return identity;
    }

    public void setIdentity(String identity) {
        this.identity = identity;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Boolean getShow() {
        return show;
    }

    public void setShow(Boolean show) {
        this.show = show;
    }

    public List<Treegrid> getChildren() {
        return children;
    }

    public void setChildren(List<Treegrid> children) {
        this.children = children;
    }

    /**
     * @return
     */
    @JSONField(serialize = false)
    public boolean isHasChildren() {
        return !getChildren().isEmpty();
    }
}
